﻿// ******************************************************
// Copyright © 2010 DCOM Productions®, 
// All Rights Reserved
// ******************************************************

namespace BitFlex.EnterpriseServices.Authentication {
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    /// <summary>
    /// Interface that performs authentication for a user
    /// </summary>
    public interface IAuthenticationService<TUser> where TUser : ISecureUser, new() {
        /// <summary>
        /// Gets or sets the encoding that will be used
        /// </summary>
        Encoding Encoding {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the type of encryption that will be used
        /// </summary>
        EncryptionType Encryption { 
            get; 
            set; 
        }

        /// <summary>
        /// Authenticates the specified user
        /// </summary>
        /// <param name="user">The user to authenticate</param>
        /// <returns>Returns an <see cref="AuthenticationResult"/> enumeration</returns>
        AuthenticationResult Authenticate(TUser user);

        /// <summary>
        /// Encrypts the specified password based on the encryption property
        /// </summary>
        /// <param name="password">The password to encrypt</param>
        /// <returns>Returns the encrypted password</returns>
        string EncryptPassword(string password);
    }
}